package com.example.shop.goods.dao;

import com.example.shop.goods.dto.GoodsTypeFondRatio;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

@Mapper
public interface GoodsTypeFondRatioDao {

    @Results(id = "GoodsTypeFondRatioDaoResultMap",value = {
            @Result(column = "goods_type",property = "goodsType"),
            @Result(column = "num",property = "num")
    })
    @Select("select g.goods_type,count(goods_type) num " +
            "from goods g join r_user_browse_history ubh " +
            "on g.goods_id = ubh.goods_id " +
            "where ubh.user_id = ${userId} " +
            "GROUP BY goods_type")
    Set<GoodsTypeFondRatio> statisticsBrowseGoodType(@Param("userId") long userId);
}
